ZFS-On-Linux is a port of the highly advanced ZFS File System that originated from the Solaris UNIX operating system. Unfortunately due to license issues that have YET to be resolved by the GPL side of things, and trust me this is petty squabbling at it's best and worst, you can't unfortunately get a Linux distribution with ZFS...
...but nobody said anything about building it from scratch yourself, and LFS is a peanut butter sandwich just waiting for some ZFS jelly. Sound tasty?
So do you want the most advanced file system for your own private build? Was that a yes? Is BtrFS still useless to you? Thought so, then, get ready to unpack some sources, and let's proceed.
First off you'll need a working kernel config. I HIGHLY recommend you use a feature complete kernel for this... such as Slackware's.
Let's unpack the sources and copy the config in.
Code:
cd /sources
tar -xvf linux-*.tar.*
cd linux-*
The (*) is mostly to target whatever kernel you may be using.
Now, grab a copy of SPL (the Solaris Porting Layer) from the zfs-on-linux website located at the link below, along with the zfs sources:
http://zfsonlinux.org/
Versions 0.6.3 should be current.
Now let's first get the kernel prepped:
Code:
cd /sources/linux-*
cp -v /boot/config-* .config
make prepare scripts
Now let's get SPL ready and fold it into Linux and the core system
For the next two steps, make sure you replace <version here> with the kernel version number:
Code:
cd ..
tar -xvf spl-*.tar.*
cd spl-*
./configure \
--prefix=/ \
--libdir=/lib \
--includedir=/usr/include \
--datarootdir=/usr/share \
--enable-linux-builtin=yes \
--with-linux=/sources/linux-<version here> \
--with-linux-obj=/sources/linux-<version here>
./copy-builtin /sources/linux-<version here>
make
make install
Now we'll get the ZFS sources ready and fold them in as well:
Code:
cd ..
tar -xvf zfs-*.tar.*
cd zfs-*
./configure \
--prefix=/ \
--libdir=/lib \
--includedir=/usr/include \
--datarootdir=/usr/share \
--enable-linux-builtin=yes \
--with-linux=/sources/linux-<version here> \
--with-linux-obj=/sources/linux-<version here> \
--with-spl=/root/src/spl-0.6.3
--with-spl-obj=/root/src/spl-0.6.3
./copy-builtin /sources/linux-<version here>
make
make install
Now you should have the SPL and ZFS utilities and libraries installed, now back in the kernel directory:
Code:
cd /sources/linux-*
make menuconfig
You should see options to add SPL and ZFS into the kernel. Make them as modules or as built-in (recommended), and then build your kernel.
You should also add in a dummy fsck.zfs utility as well since ZFS doesn't use this.
Code:
cat > /sbin/fsck.zfs << "EOF"
#!/bin/sh
exit 0
"EOF"
In theory, you could pipe the command to "zpool scrub", but that's not well advised.
Congratulations! You've now got a Linux kernel with support for the most advanced filesystem, ZFS.
Final word of advice:
If you want to create a zpool that mounts using good ol' mount and fstab style options, use something like this command when you configure the zpool:
Code:
zfs set mountpoint=legacy zfs-root
Have fun kiddies!!!